package com.medium.house.controller;

import com.medium.house.biz.HouseQueryConditionBiz;
import com.medium.house.service.HouseSellPointService;
import com.medium.house.service.impl.HouseSellPointServiceImpl;
import com.medium.house.vo.ResultVO;
import com.medium.house.vo.ResultVOUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author : wang.yu
 * @Description :
 * @Date: Created in 2018/2/7 0007  20:41
 * @Modified By
 */
@Api(value = "/condition",description="页面筛选条件",tags={"页面筛选条件接口"})
@RestController
@RequestMapping("/api/condition/")
@Slf4j
@SuppressWarnings("all")
public class HouseConditionController {
    @Autowired
    private HouseQueryConditionBiz houseQueryConditionBiz;
    @Autowired
    private HouseSellPointService houseSellPointService;

    @ApiOperation("搜索筛选条件")
    @PostMapping("search")
    public ResultVO getHouseQueryCondition(@RequestParam Integer type,
                                           @RequestParam Integer status){
        return ResultVOUtil.success(houseQueryConditionBiz.getCondition(type,status));
    }

    @ApiOperation("获取房屋特色")
    @PostMapping("sellPoint")
    public ResultVO sellPoint(@RequestParam Integer type,
                              @RequestParam Integer status){
        return ResultVOUtil.success(houseSellPointService.getByTypeAndStatus(type,status));
    }

    @ApiOperation("获取房屋特色and筛选条件作为录入项")
    @PostMapping("input")
    public ResultVO input(@RequestParam Integer type,
                              @RequestParam Integer status){
        return ResultVOUtil.success(houseQueryConditionBiz.getConditionAndSellPoint(type,status));
    }
}
